const express = require('express')
const bodyParser = require('body-parser')


const app = express()

app.set('view engine', 'ejs')
app.get('/', (req, res) => {
    res.render('form')
})

app.use(bodyParser.urlencoded({extended: false}))

app.post('/', (req, res) => {
    const {username, password} = req.body
    if (username === 'guaguaerhao' && password === '123123') {
        res.end('登录成功')
    } else {
        res.end('账号或密码错误')
    }
})

app.listen(3000)
